package gui.win.data.rm;

import gui.Segl1;
import gui.utils.Borders;
import gui.utils.ComboBox;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;

/*Author: John Archer, Contact: john.archer.jpa@gmail.com*/
public class RmD extends JFrame{
    private CardLayout layout_2;
    private JPanel dependentDatasetComboBox;
    public RmD(Segl1 Seg_L1){
        super();
        this.setLocation(Seg_L1.getLocationOnScreen().x + 50, Seg_L1.getLocationOnScreen().y + 50);
        this.setLayout(new FlowLayout());
        this.setSize(new Dimension(400, 176));
        JPanel p = new JPanel();
        p.setBorder(Borders.getTitledBorder(Borders.STANDARD_TITLED_BORDER, "REMOVE DATA"));
        p.setLayout(new BorderLayout());
        p.add(new ComboBox("PROJECT", ComboBox.PROJECT_SELECT_AND_LINKED_DATASET_TO_REMOVE_SELECT, this, 310, 25), BorderLayout.NORTH);
        dependentDatasetComboBox = new JPanel();
        dependentDatasetComboBox.setLayout(layout_2 = new CardLayout());
        dependentDatasetComboBox.add(new ComboBox("DATASET", ComboBox.REMOVE_DATASET_SELECT, 310, 25), "1");
        layout_2.show(dependentDatasetComboBox, "1");
        p.add(dependentDatasetComboBox, BorderLayout.CENTER);
        this.add(p, BorderLayout.CENTER);
        this.add(new Buttons(Seg_L1, this), BorderLayout.SOUTH);
        this.setVisible(true);
        this.setAlwaysOnTop(true);
    }

    int counter = 0;
    public void resetAssociatedDatasetCombobox(){
        counter++;
        String title = counter+"";
        dependentDatasetComboBox.add(new ComboBox("DATASET", ComboBox.REMOVE_DATASET_SELECT, 310, 25), title);
        layout_2.show(dependentDatasetComboBox, title);
    }

    public void closeFrame(){this.dispose();}
}